<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1{
            width: 100px;
            height: 100px;
            background-color: red;
            position: absolute;
            left: 0;
        }
        #box2{
            width: 100px;
            height: 100px;
            background-color: yellow;
            position: absolute;
            left: 0;
            top: 200px;
        }
    </style>
    <script src="../JS/tools.js"></script>
    <script>
            
        window.onload = function(){
            var btn01 = document.getElementById("btn01");
            var btn02 = document.getElementById("btn02");
            var btn03 = document.getElementById("btn03");
            var box1 = document.getElementById("box1");
            var box2 = document.getElementById("box2");
            btn01.onclick = function(){
                move(box1,"left",800,10);
            };
            btn02.onclick = function(){
                move(box1,"left",0,10);
            };
            btn03.onclick = function(){
                move(box2,"left",0,10,function(){
                        move(box2,"top",200,10,function(){
                            move(box2,"height",100,10,function(){
                                move(box2,"width",100,10);
                            
                        });
                    });
                });
            };
            btn04.onclick = function(){
                // move(box2,"left",800,10);
                move(box2,"width",800,10,function(){
                    move(box2,"height",500,10,function(){
                        move(box2,"top",0,10,function(){
                            move(box2,"top",300,10,function(){
                                move(box2,"left",800,10);
                            });
                        });
                    });
                });
            };
           
        };
    </script>
  
<body>
    <button id="btn01">红色块向右</button>
    <button id="btn02">红色块向左</button>
    <button id="btn03">恢复按钮</button>
    <button id="btn04">测试按钮</button>
    <br><br>
    <div id="box1"></div>
    <div id="box2"></div>
    <div style="height: 500px; width: 0; border-left: 1px black solid; position: absolute; left: 800px; top: 0;"></div>
</body>
</html>